package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.IAwardMoreActivityModel;
import com.wgts.wgts.mvp.presenter.IAwardMoreActivityPresenter;
import com.wgts.wgts.mvp.view.IAwardMoreActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.resp.AwardMoreListEntity;

import java.util.List;

/*
 *
 *   data:2018/10/1211:37
 *
 */public class AwardMoreActivityPresenter implements IAwardMoreActivityPresenter{
     private IAwardMoreActivityView view;
     private IAwardMoreActivityModel model;

    public AwardMoreActivityPresenter(IAwardMoreActivityView view, IAwardMoreActivityModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void initList() {
        model.initList(new HttpResultSubscriber<List<AwardMoreListEntity>>() {
            @Override
            public void onSuccess(List<AwardMoreListEntity> awardMoreListEntities) {
                view.initList(awardMoreListEntities, true);
                /*pageIndex = 1;
                if (awardMoreListEntities.size() < pageSize){
                    view.initList(awardMoreListEntities, true);
                }else {
                    view.initList(awardMoreListEntities, false);
                    pageIndex++;
                }*/
            }

            @Override
            public void _onError(int status, String msg) {

            }
        });
    }

    @Override
    public void loadMore() {
        /*model.initList(pageIndex, pageSize, new HttpResultSubscriber<List<AwardMoreListEntity>>() {
            @Override
            public void onSuccess(List<AwardMoreListEntity> listEntities) {
                if (listEntities.size() < pageSize){
                    view.initList(listEntities, true);
                }else {
                    view.initList(listEntities, false);
                    pageIndex++;
                }
            }

            @Override
            public void _onError(int status, String msg) {

            }
        });*/
    }
}
